Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor wasm codes #9

Merged
merged 15 commits into from
Jun 12, 2024
Merged

Refactor wasm codes #9

merged 15 commits into from
Jun 12, 2024

Conversation

rumgrum
Copy link
Collaborator

@rumgrum rumgrum commented May 28, 2024

1- Move wasm codes to db
2- Reload the codes every 2 seconds(temp)
3- Encapsulate some of the codeIds ops

Copy link
Member

@NoahSaso NoahSaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i love this design! nice i think this is pretty close.

there are a few patterns i think could be cleaned up.

  1. i don't see a huge point into separating WasmCodeUpdater from WasmCodeService. it feels like the service should just be able to handle everything. maybe it can have two new functions that are like startUpdatingFromDB and stopUpdatingFromDB, and the start function can be called automatically when the newWithWasmCodesFromDB service creator is used.
  2. since it's becoming a service, i expect it to be removed from config entirely instead of adding the service to the config object. i like the idea of adding the updater's singleton pattern to the service itself, and instead of using config.wasmCodes?... everywhere, using WasmCodeService.getInstance().... i think config should remain just the serializable data loaded from the file.
  3. no need to update every 2 seconds. changes will be quite rare. maybe 60 seconds?
  4. let's move this to a new services folder in src/services/wasm-codes instead of right in the src folder. it's becoming a bit unruly.

thanks so much for doing this. you are clearly very capable :)

src/db/migrations/20240521012355-create-wasm-code-key.ts Outdated Show resolved Hide resolved
src/db/models/WasmCodeKey.ts Outdated Show resolved Hide resolved
src/db/models/WasmCodeKey.ts Outdated Show resolved Hide resolved
src/db/models/WasmCodeKeyId.ts Outdated Show resolved Hide resolved
src/scripts/export/process.ts Outdated Show resolved Hide resolved
src/wasmcodes/wasm-code.service.ts Outdated Show resolved Hide resolved
src/wasmcodes/wasm-code.service.ts Outdated Show resolved Hide resolved
src/wasmcodes/wasm-code.service.ts Outdated Show resolved Hide resolved
Copy link
Member

@NoahSaso NoahSaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good changes. i think there's some more cleanup necessary but the service is pretty stable

src/services/wasm-codes/wasm-code.service.ts Outdated Show resolved Hide resolved
src/services/wasm-codes/wasm-code.service.ts Outdated Show resolved Hide resolved
src/services/wasm-codes/wasm-code.service.ts Outdated Show resolved Hide resolved
src/services/wasm-codes/wasm-code.service.ts Outdated Show resolved Hide resolved
src/services/wasm-codes/wasm-code.service.ts Outdated Show resolved Hide resolved
src/services/wasm-codes/wasm-code.service.ts Outdated Show resolved Hide resolved
src/services/wasm-codes/wasm-code.service.ts Outdated Show resolved Hide resolved
src/core/config.ts Outdated Show resolved Hide resolved
Copy link
Member

@NoahSaso NoahSaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sick!!!! just one more thing 😁

and there's one more conversation left up there unresolved ^

src/services/wasm-codes/wasm-code.service.ts Outdated Show resolved Hide resolved
@baoskee
Copy link

baoskee commented Jun 11, 2024

Looking delicious!

@NoahSaso
Copy link
Member

can you rebase on my latest changes from main to fix the merge conflicts?

Copy link
Member

@NoahSaso NoahSaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!!!!!!!

@NoahSaso NoahSaso merged commit 083f996 into main Jun 12, 2024
1 check failed
@NoahSaso NoahSaso deleted the refactor-codes branch June 12, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants